<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require dirname(__FILE__).'/pc_controller.php';

class Activity_url extends PC_controller {

    public function __construct(){
        parent::__construct();
        $this->load->model('Activitymodel','m_activity');
        $this->load->model('Templatemodel','m_template');
    }

    public function index(){
        $data = parent::index();

        $data['attr'] = array();
        $data['attr']['template_list'] = $this->m_template->getActiveTemplateList();

        $this->load->view('admin/activity_url',$data);
    }

    public function getActivityUrlList(){
        $assist['where'] = getFilter($this->input->post(),Activitymodel::$searchField);
        $assist['like'] = getFilter($this->input->post(),Activitymodel::$likeField);
        $assist['sort'] = getSort($this->input->post(),Activitymodel::$sortField);
        $assist['pagination'] = getPagination($this->input->post());

        $assist['join_activity'] = true;
        $assist['join_history'] = true;
        $assist['join_customer'] = true;

        list($list,$count) = $this->m_activity->getActivityUrlListSection($assist);

        $this->response->setSuccess();
        $this->response->setItems($list);
        $this->response->setTotalCount($count);
        $this->response->responseExit();
    }

    public function disableActivityUrl(){
  		$this->validate->setRule('activity_url_id','integer');
      if(!$this->validate->run($this->input->post())){
        $this->response->setDetail($this->validate->getMessage());
        $this->response->responseExit();
      }
      $info = $this->validate->getResult();
      $info['user_id'] = $this->m_app->getCurrentUserId();
      $info['activity_url_status'] = STATUS_DISABLE;

      $this->m_activity->editActivityUrl($info);


      $this->response->setSuccess();
      $this->response->responseExit();
    }


}
/* End of file api_log.php */
/* Location: ./application/controllers/api_log.php */
